#ifndef IMGMORPHOLOGY_H
#define IMGMORPHOLOGY_H

#include <QImage>
#include <vector>
using namespace std;

class ImgMorphology
{
public:
    ImgMorphology(QImage *m_Img1);

    //形态学的处理
    QImage* toErosion();//腐蚀
    QImage* toExpansion();//膨胀
    QImage* toOpening();
    QImage* toClosing();

    //获取邻域内像素的最值
    vector<int> getMaxPixel(int x, int y);
    vector<int> getMinPixel(int x, int y);
    vector<int> getPixelAvg(int x, int y);//获取对应位置处像素的均值  xy若超出范围 返回-1

private:
    QImage *m_Img;
    QImage *m_ImgOriginal;
};

#endif // IMGMORPHOLOGY_H
